package com.example.moduletwo.adapter;

import android.content.Context;
import android.view.View;

import com.example.baselibrary.util.LKToastUtil;
import com.example.moduletwo.R;
import com.example.moduletwo.adapter.binder.TestAdapterBinder;
import com.example.moduletwo.adapter.binder.TestTwoAdapterBinder5;
import com.example.moduletwo.adapter.delegate.TestAdapterDelegate;
import com.example.moduletwo.adapter.delegate.TestTwoAdapterDelegate5;
import com.example.moduletwo.bean.BeanFive;
import com.example.mvp.adapter.BaseLibAdapter;
import com.example.mvp.binder.BaseDataBinder;

import java.util.List;

/**
 * 测试适配器操作处理类
 * Created by sun.li on 2018/6/6.
 *
 * @author sun.li
 */

public class TestFiveAdapter extends BaseLibAdapter<TestTwoAdapterDelegate5,BeanFive>{

    public TestFiveAdapter(Context context, List<BeanFive> mList) {
        super(context, mList);
    }

    @Override
    protected void bindEvenListener(TestTwoAdapterDelegate5 viewDelegate,  int position) {
        atiTextOnClickListener(viewDelegate,position);
    }

    private void atiTextOnClickListener(final TestTwoAdapterDelegate5 viewDelegate, final int position) {
        viewDelegate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null!=getData()){
                    String str = getData().get(position).getStr1();
                    LKToastUtil.showToastShort(str);
//                    viewDelegate.setText(str+"_"+v.getId());
                    getData().get(position).setStr1(str+"_"+v.getId());
                    notifyDataSetChanged();
                }
            }
        }, R.id.tv_ati5_text_1);
    }

    @Override
    protected void notifyView(TestTwoAdapterDelegate5 viewDelegate,  int position) {
//        viewDelegate.setText(getData().get(position));
    }

    @Override
    public Class getDelegateClass() {
        return TestTwoAdapterDelegate5.class;
    }

    @Override
    public BaseDataBinder getDataBinder() {
        return new TestTwoAdapterBinder5();
//        return null;
    }
}
